package com.share.pattern.observer;

import java.util.Scanner;

/**
 * 
 * @author Johnny Tam 
 * * v0.1版本 观察者模式
 */
public class ObserverDemo {

	public static void main(String[] args) {
		//前台
		Secretary qiantai = new Secretary();
		
		//看股票的同事
		StockObserver tongshi1 = new StockObserver("曹老师", qiantai);
		StockObserver tongshi2 = new StockObserver("薇薇老师", qiantai);
		
		//前台记下2为同事
		qiantai.Attach(tongshi1);
		qiantai.Attach(tongshi2);
		
		//发现老板回来了， 赶紧通知
		qiantai.setAction("老板回来了！");
		
		//通知2为同事
		qiantai.Notify();
	}

}
